home *** CD-ROM | disk | FTP | other *** search
/ The X-Philes (2nd Revision) / The X-Philes Number 1 (1995).iso / xphiles / hp95 / gnuchess.arc / hp95.h < prev    next >
Text File  |  1992-01-16  |  7KB  |  187 lines

  1. /************************************************************************
  2.   * Definitions.                            *
  3.   ************************************************************************/
  4.  
  5. /**********************************************************************/
  6. /*   Normal text size.                              */
  7. /**********************************************************************/
  8. # define    FONT_WIDTH    6
  9. # define    FONT_HEIGHT    8
  10.  
  11. # define    MAX_X    239
  12. # define    MAX_Y    127
  13.  
  14. #define    G_ALPHA_SM    0x07
  15. #define    G_ALPHA        0x87
  16. #define    G_GRAPHICS_SM    0x20
  17. #define    G_GRAPHICS    0xa0
  18.  
  19. #define    G_FORCE        0
  20. #define    G_AND        1
  21. #define    G_OR        2
  22. #define    G_XOR        3
  23. #define    G_NOTFORCE    4
  24. #define    G_NOTAND    5
  25. #define    G_NOTOR        6
  26. #define    G_NOTXOR    7
  27.  
  28. #define    G_OUTLINE    0
  29. #define    G_SOLIDFILL    1
  30. #define    G_PATTERNFILL    2
  31.  
  32. #define    MINCOLOR    0
  33. #define    MAXCOLOR    1
  34.  
  35. /************************************************************************
  36.   * Structures.                                *
  37.   ************************************************************************/
  38.  
  39. typedef    struct g_info {
  40.     unsigned char    vidmode;
  41.     unsigned char    defmode;
  42.     unsigned int    xpixels;
  43.     unsigned int    ypixels;
  44.     int        xloc;
  45.     int        yloc;
  46.     unsigned int    linetype;
  47.     int        rrule;
  48.     unsigned int    color;
  49.     int        xclipmin;
  50.     int        yclipmin;
  51.     int        xclipmax;
  52.     int        yclipmax;
  53.     int        xlorg;
  54.     int        ylorg;
  55.     unsigned char    fillmask[8];
  56.     } G_INFO;
  57.  
  58. /**********************************************************************/
  59. /*   Structure used for READ AREA and WRITE AREA              */
  60. /**********************************************************************/
  61. typedef struct g_area {
  62.     short    planes;        /* always 1 */
  63.     short    bits_per_pixel; /* always 1 */
  64.     short    width;
  65.     short    height;
  66.     } G_AREA;
  67.  
  68. /************************************************************************
  69.   * Graphics library function definitions.  All x,y locations are rel-    *
  70.   *   ative to the current logical origin unless specified otherwise.    *
  71.   ************************************************************************/
  72. void   far cdecl    G_Mode(int);
  73. G_INFO far * cdecl    G_GetInfo(G_INFO far *);
  74. void   far cdecl    G_ColorSel(int);
  75. void   far cdecl    G_RepRule(unsigned int);
  76. void   far cdecl    G_LineType(unsigned int);
  77. void   far cdecl    G_FillMask(unsigned char far *);
  78. void   far cdecl    G_LorgA(int, int);
  79. void   far cdecl    G_ClipL(int, int, int, int);
  80. void   far cdecl    G_Move(int, int);
  81. void   far cdecl    G_Point(int, int);
  82. int    far cdecl    G_PointRead(int, int);
  83. void   far cdecl    G_Draw(int, int);
  84. void   far cdecl    G_Rect(int, int, int);
  85. void   far cdecl    G_ImageGet(int, int, int, int, char far *);
  86. void   far cdecl    G_ImagePut(int, int, char far *, int);
  87. void   far cdecl    G_Text(int, int, char far *, int);
  88. void            draw_small_string(int, int, char far *);
  89.  
  90. /*************************************************************************/
  91.  
  92. /**** G_MODE(mode): mode = {G_TEXT | G_GRAPHICS}
  93.     changes the display mode to text or graphics        */
  94.  
  95. /**** G_GETINFO(GraphInfoPtr): GraphInfoPtr is a far pointer to a buffer of
  96.     the programmers choosing where the graphics information will be copied.
  97.     See the typedef for the G_INFO structure in this file for the contents
  98.     of the buffer.    */
  99. /*************************************************************************/
  100.  
  101. /**** G_COLORSEL(color): color = 0 or 1
  102.     sets the current pen to "color"                */
  103.  
  104. /**** G_REPRULE(reprule): reprule = {G_FORCE | G_AND | G_OR | G_XOR}
  105.     sets the current replacement rule for all other drawing (except for
  106.     G_ImagePut, which specifies its own replacement rule). */
  107.  
  108. /**** G_LINETYPE(linetype): linetype = a 16-bit image that is repeated while
  109.     drawing lines and G_OUTLINE'd rectangles.  Bits that are 1 cause the
  110.     current pen color to be plotted using the current replacement rule.
  111.     Bits that are 0 are not plotted and leave the display un-modified. */
  112.  
  113. /**** G_FILLMASK(buffer): buffer is a far pointer to an 8-byte array which
  114.     specifies the fillmask to use when doing drawings of rectangles
  115.     with a fillflag of G_PATTERNFILL.  Every bit that is a 1 will
  116.     cause a point of the current color to be plotted.  Every bit that is
  117.     a 0 will cause that "point" of the display to be undisturbed. */
  118. /*************************************************************************/
  119.  
  120. /**** G_LORGA(x,y): x,y = -32768 to +32767
  121.     sets the logical origin (0,0) to be located at the absolute screen
  122.     coordinate specified by x,y. */
  123.  
  124. /**** G_CLIPL(x1, y1, x2, y2): x1,y1,x2,y2 = -32768 to +32767
  125.     sets the current clip boundary to the rectangle whose diagonally
  126.     opposite corners are specified by the absolute screen coordinates
  127.     equal to the x1,y1 and x2,y2 offsets from the current logical origin.*/
  128. /*************************************************************************/
  129.  
  130. /**** G_MOVE(x, y): x,y = -32768 to +32767
  131.     causes the logical pen to be moved to "x,y"        */
  132.  
  133. /**** G_POINT(x,y): x,y = -32768 to +32767
  134.     plots a point of the current pen color with the current replacement
  135.     rule at "x,y" unless "x,y" is outside the current clip limits    */
  136.  
  137. /**** G_POINTREAD(x,y): x,y = -32768 to +32767
  138.     reads the color of the point located at x,y and returns that as the
  139.     value of the function. */
  140.  
  141. /**** G_DRAW(x,y): x,y = -32768 to +32767
  142.     draws a line of the current pen color with the current replacement rule
  143.     and the current linetype from the current pen location to "x,y";
  144.     only those points lying within the clip limits are actually plotted. */
  145.  
  146. /**** G_RECT(x,y,fillflag): x,y = -32768 to +32767
  147.     fillflag = {G_OUTLINE | G_SOLIDFILL | G_PATTERNFILL}
  148.     draws a rectangle with diagonally opposite corners at the current pen
  149.     location and at "x,y", using the current pen color and replacement
  150.     rule.  The "type" of rectangle drawn is determined by fillflag.
  151.     if fillflag==G_OUTLINE, the outline of a rectangle is drawn, using the
  152.         current linetype.
  153.     if fillflag==G_SOLIDFILL, a solid, filled rectangle of the current
  154.         color is drawn.
  155.     if fillflag==G_PATTERNFILL, a pattern filled rectangle of the current
  156.         color is drawn, using the current fill mask.    */
  157. /*************************************************************************/
  158.  
  159. /**** G_IMAGEGET(x1, y1, x2, y2, buffer):  x1,y1,x2,y2 = -32768 to +32767
  160.     If both points x1,y1 and x2,y2 are within the current clip boundary,
  161.     the display image bounded by the rectangle whose diagonally opposite
  162.     corners are x1,y1 and x2,y2 is read into the bytes pointed to by
  163.     "buffer". 
  164.  
  165.    NOTE: for G_ImageGet(), the required size of 'buffer' is (on Jaguar):
  166.  
  167.     8 + ((x2-x1+8)/8) * (y2-y1+1) bytes          */
  168.  
  169. /**** G_IMAGEPUT(x, y, buffer, reprule): x,y = -32768 to +32767
  170.     reprule = {G_FORCE | G_AND | G_OR | G_XOR | G_NOTFORCE | G_NOTAND |
  171.             G_NOTOR | G_NOTXOR}
  172.     if x,y and the un-specified bottom-right corner of the image are
  173.     within the clip boundary, the image from "buffer" is drawn on the
  174.     display using reprule as the replacement rule.  (For the "NOT" replace-
  175.     ment rules, the image is color-inverted first, then placed on the
  176.     display using the "rest" of the replacement rule.) */
  177. /*************************************************************************/
  178.  
  179. /**** G_TEXT(x,y,buffer,rotflag): x,y = -32768 to +32767, rotflag = 0 or 1
  180.     draws the string pointed to by "buffer" on the display at the specified
  181.     location x,y using the current font. If rotflag = 0, it's drawn
  182.     horizontally, else it's rotated 90 degrees counterclockwise. */
  183. /*************************************************************************/
  184.  
  185.  
  186.  
  187.